package com.demo;

import com.method.Student;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 故我
 * Date: 2023-10-26
 * Time: 20:04
 */
@Component
public class StudentBeans {
    @Bean //(name = {"s1", "s2"})//采用了name的形式就不能使用默认的类名称规则
    public Student student1() {
        Student student = new Student();
        student.setId(100);
        student.setAge(20);
        student.setName("张三");

        return student;
    }

    @Bean
    public Student student2() {
        Student student = new Student();
        student.setId(101);
        student.setAge(22);
        student.setName("李四");

        return student;
    }
}
